package Offer;

public class Test41a 
{

	public static void main(String[] args) 
	{
		find(9);

	}
    public static void find(int sum)
    {
    	if(sum<3)
    		return;
    	int start=1;
    	int end=2;
    	int curSum = start+end;
    	while(start<(sum+1)/2)
    	{
    		if(curSum==sum)
    		{
    			print(start,end);
    		  
    		}
    		while(start<(sum+1)/2&&curSum>sum)
        	{
    			curSum-=start;
    			++start;
    			if(curSum==sum)
        		{
        			print(start,end);
        		}
        	}
    		end++;
  		    curSum+=end;
    	}
    }
    public static void print(int start,int end)
    {
    	for(int i=start;i<=end;i++)
    	{
    		System.out.print(i);
    		System.out.print(" ");
    	}
    }
}
